home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-01 | 3.7 KB | 122 lines | [TEXT/EDIT] |
- C FaceWare 2.2 Initialization & Dispatching Procedures
- C ©FaceWare 1989-93. All Rights Reserved.
-
- SUBROUTINE FaceIt(xPtr,m1,m2,m3,m4,m5)
- implicit none
- INTEGER FRONTWINDOW,GETRESOURCE,HIDEWINDOW,OPENRESFILE,PTR
- INTEGER TEINIT,INITDIALOGS,FLUSHEVENTS,EXITTOSHELL
- PARAMETER (EXITTOSHELL=Z'9F400000')
- PARAMETER (FLUSHEVENTS=Z'03200008') !include file is wrong
- PARAMETER (FRONTWINDOW = Z'92480000')
- PARAMETER (GETRESOURCE = Z'9A091000')
- PARAMETER (HIDEWINDOW = Z'91610000')
- PARAMETER (OPENRESFILE = Z'99770000')
- PARAMETER (PTR = Z'C0000000')
- PARAMETER (TEINIT = Z'9CC00000')
- PARAMETER (INITDIALOGS = Z'97B10000')
- integer*2 fHead(8),uHead(8),vHead(8),xEntries
- integer*4 i,xPtr,m1,m2,m3,m4,m5,thePtr,fPtr,toolbx,ftnWin
- integer*4 fFlags,uCommand,uParam(4),cControl,xTable(40)
- character*4 restype
- character*256 uName
- integer*1 fRec(2548)
- common/FaceStuff/fRec
- equivalence (fRec(1),fHead(1))
- equivalence (fRec(39),fFlags)
- equivalence (fRec(1003),uHead(1))
- equivalence (fRec(1071),uCommand)
- equivalence (fRec(1075),uParam(1))
- equivalence (fRec(1359),uName)
- equivalence (fRec(1635),vHead(1))
- equivalence (fRec(1703),cControl)
- equivalence (fRec(2387),xEntries)
- equivalence (fRec(2389),xTable(1))
- thePtr = xPtr
- fPtr = toolbx(PTR,fRec)
- if (m1 = -61) then
- if ((m4 > -1).and.((m4.and.1) = 0)) then
- call toolbx(TEINIT) !perform Mac initializations
- call toolbx(INITDIALOGS,0)
- call toolbx(FLUSHEVENTS,62) !ignore spurious mouse & key events
- ftnWin = toolbx(FRONTWINDOW) !unneeded Fortran window?
- if (ftnWin <> 0) call toolbx(HIDEWINDOW,ftnWin)
- end if
- uName = char(len(trim(uName)))//uName
- restype = 'FCMD' !find LoadIt or quit to Finder
- if (toolbx(GETRESOURCE,restype,1000) = 0) then
- if (toolbx(OPENRESFILE,uName) < 0) then
- call toolbx(EXITTOSHELL)
- end if
- end if
- fFlags = m2 !store FaceIt bit flags
- xEntries = m5 !store # of table entries
- thePtr = fPtr
- if (m3 > -1) then !call LoadIt to expand heap?
- call PrepIt(thePtr,m3,0,0,thePtr)
- call JumpIt(thePtr)
- end if
- call PrepIt(thePtr,1100,22,0,thePtr) !setup fRec header
- call PrepIt(thePtr+1002,1210,22,0,thePtr) !setup uRec header
- call PrepIt(thePtr+1634,1200,22,0,thePtr) !setup vRec header
- fHead(6) = m4 !store environment type
- uHead(6) = 2 !establish string type
- thePtr = 0
- if (m4 < -3) return
- end if
- if (m1 = -62) then
- call PrepIt(m2,m3,m4,m5,fPtr)
- else if ((m1 < 0).and.(m1 > -11)) then
- i = (4 * (-1 - m1))
- xTable(1+i) = m2
- xTable(2+i) = m3
- xTable(3+i) = m4
- xTable(4+i) = m5
- else
- if (thePtr = 0) then !call to default module?
- thePtr = fPtr + 1002
- else if (long(thePtr + 12) <> fPtr) then
- cControl = thePtr !call to control driver?
- thePtr = fPtr + 1634
- end if
- word(thePtr + 8) = 0
- uCommand = m1 !pass Command & Params
- uParam(1) = m2
- uParam(2) = m3
- uParam(3) = m4
- uParam(4) = m5
- call JumpIt(thePtr) !jump to FCMD module
- end if
- end
-
- SUBROUTINE PrepIt(x,b,v,r,f)
- implicit none
- INTEGER GETRESOURCE
- PARAMETER (GETRESOURCE = Z'9A091000')
- integer*4 i,x,b,v,r,f,toolbx
- character*4 restype
- integer*2 xEntries
- integer*4 xTable(40)
- integer*1 fRec(2548)
- common/FaceStuff/fRec
- equivalence (fRec(2387),xEntries)
- equivalence (fRec(2389),xTable(1))
- restype = 'FCMD'
- long(x) = long(toolbx(GETRESOURCE,restype,1000))
- word(x + 4) = b !baseID
- word(x + 6) = v !versID
- word(x + 8) = 0 !message
- word(x + 10) = r !resID
- long(x + 12) = f !fPtr
- if (xEntries > 0) then
- do (i = 0, xEntries-1)
- if (b = xTable(1 + 4*i)) then
- if (v = xTable(2 + 4*i)) then
- if (0 <> xTable(4 + 4*i)) then
- long(x) = xTable(4 + 4*i)
- end if
- end if
- end if
- repeat
- end if
- end
-